﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace TrackIT.Common.Repositories
{
    public interface IWorkLogRepository
    {
        void Load();

        void Save();

        WorkEntry Start(string task);

        WorkEntry Stop();

        WorkEntry GetLast();

        WorkEntryType GetNextActionType();

        IEnumerable<Task> Tasks { get; }

        WorkEntry Current { get; }

        Task GetTaskByName(string taskName);

        TimeSpan GetTimeSpentOnTask(string taskName);

        List<string> GetWorkSummary(FilterDates filterDates);

        string GetTemporaryFolderName(ReportType reportType);

        string GetReportName(ReportType reportType);

        FilterDates ResolveDatesFromReportType(ReportType reportType);

        IEnumerable<WorkEntry> WorkItems { get; }
    }

    [ExcludeFromCodeCoverage]
    [ContractClassFor(typeof(IWorkLogRepository))]
    abstract class WorkLogRepositoryContract
    {
        public void Load()
        {
        }

        public void Save()
        {
        }

        public WorkEntry Start(string task)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(task));

            return default(WorkEntry);
        }

        public WorkEntry Stop()
        {
            return default(WorkEntry);
        }

        public WorkEntry GetLast()
        {
            return default(WorkEntry);
        }

        public WorkEntryType GetNextActionType()
        {
            return default(WorkEntryType);
        }

        public IEnumerable<Task> Tasks
        {
            get { return default(IEnumerable<Task>); }
        }

        public WorkEntry Current
        {
            get { return default(WorkEntry); }
        }

        public Task GetTaskByName(string taskName)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(taskName));

            return default(Task);
        }

        public TimeSpan GetTimeSpentOnTask(string taskName)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(taskName));

            return default(TimeSpan);
        }

        public List<string> GetWorkSummary(FilterDates filterDates)
        {
            Contract.Requires(filterDates != null);

            return default(List<string>);
        }

        public string GetTemporaryFolderName(ReportType reportType)
        {
            return default(string);
        }

        public string GetReportName(ReportType reportType)
        {
            return default(string);
        }

        public FilterDates ResolveDatesFromReportType(ReportType reportType)
        {
            return default(FilterDates);
        }
    }
}